<?php

namespace api\controllers;

use Firebase\JWT\JWT;
use Yii;
use yii\filters\VerbFilter;
class UserController extends BaseController
{
    public $modelClass = 'common\models\Qrcode';

   
    public $except = ['login'];
    public function behaviors()
    {
        $behaviors = parent::behaviors();
        $behaviors['verbs'] = [
            'class' => VerbFilter::class,
            'actions' => [
                'login' => ['post','get'],
            ],
        ];

        return $behaviors;
    }

    public function actionIndex()
    {

        // return Yii::$app->user->isGuest;
        return Yii::$app->getUser()->identity->id;
        return ['aa' => 'cc'];
        return [];
        return 'aa';
        return false;
        return NULL;
        // return 'fasdfasdf';
        // throw new BadRequestHttpException('参数错误');
        return ['aaa' => 'bbb'];
    }

    public function actionLogin(){
        return JWT::encode(['test' => 'ok'],Yii::$app->params['jwt_key']);
    }
}
